package com.limao.DBProvider;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;

import com.limao.DBDataClass.SysIceBuyAutoDataClass;
import com.limao.DbConnection.DbConnectionManager;

public class SysIceBuyAutoProvider {

	private static class DB_Adv_ProviderContainer {
		private static SysIceBuyAutoProvider instance = new SysIceBuyAutoProvider();
	}

	public static SysIceBuyAutoProvider getInstance() {
		return DB_Adv_ProviderContainer.instance;
	}

	
	
	public ArrayList<SysIceBuyAutoDataClass> Load_IceBuyAuto_All()
	{
		ArrayList<SysIceBuyAutoDataClass> list = new ArrayList<SysIceBuyAutoDataClass>();
		Connection con = null;
		PreparedStatement pstmt = null;
		ResultSet rs = null;
		try {
			con = DbConnectionManager.getConnection();
			pstmt = con.prepareStatement("select * from cd_sys_icebuyauto where state=1 and rmbrate>0");
			rs = pstmt.executeQuery();
			while (rs.next()) {
				SysIceBuyAutoDataClass obj = new SysIceBuyAutoDataClass();
				obj.paramid = rs.getString("paramid") ;// ID
				obj.type = rs.getString("type");
				obj.level = rs.getString("level");
				obj.day= rs.getString("day");
				obj.rmbrate= rs.getString("rmbrate");
				obj.state = rs.getString("state");
				list.add(obj);
			}
		} catch (Exception e) {
			list=null;
			e.printStackTrace();
		} finally {
			DbConnectionManager.closeConnection(rs, pstmt, con);
		}
		return list;
	}
	
	
}
